<?php
function getLast(array $array  = []){
    $i = 1;
    foreach ($array as $k => $v){
        array_shift($array);
        if ($i == 3){
            break;
        }else{
            $array[] = $v;
            $i++;
        }
    }
    if (count($array) >= 3){
        return getLast($array);
    }else{
        return $array;
    }
}